package com.gla.rabbitmq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/demo")
public class MQTest {


    @Autowired
    private  RabbitmqOrderProducer orderProducer;

    @RequestMapping("/")
    @ResponseBody
    String home(){
        return "Hello World!";
    }

    @RequestMapping("/mq")
    @ResponseBody
    public void test(){

        orderProducer.publish("aa", "aa", DelayConstant.ORDER_DELAY_EXCHANGE, DelayConstant.ORDER_DELAY_ROUTING_KEY);
        orderProducer.publish("bb", "bb", DelayConstant.ORDER_DELAY_EXCHANGE, DelayConstant.ORDER_DELAY_ROUTING_KEY);

        System.out.println("成功");
    }


}
